﻿namespace Blog.Service
{
    public interface ICrudService<T> 
    {
        /// <summary>
        /// 返回主键
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<bool> Add(T entity);

        /// <summary>
        /// 批量返回主键
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<bool> Add(List<T> entity);

        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<bool> Update(T entity);

        /// <summary>
        /// 根据主键删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<bool> Delete(dynamic id);

        /// <summary>
        /// 软删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<bool> SoftDelete(dynamic id);

        /// <summary>
        /// 批量软删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<bool> SoftDelete(dynamic[] id);

        Task<T> Find(dynamic id);

        Task<List<T>> GetAll();

    }
}